Computing the Longest Common Prefix of a Context-free Language in Polynomial Time
نویسندگان
چکیده
We present two structural results concerning longest common prefixes of non-empty languages. First, we show that the longest common prefix of the language generated by a context-free grammar of size N equals the longest common prefix of the same grammar where the heights of the derivation trees are bounded by 4N . Second, we show that each non-empty language L has a representative subset of at most three elements which behaves like L w.r.t. the longest common prefix as well as w.r.t. longest common prefixes of L after unions or concatenations with arbitrary other languages. From that, we conclude that the longest common prefix, and thus the longest common suffix, of a context-free language can be computed in polynomial time.
منابع مشابه
Relative Prefix Distance Between Languages
The prefix distance between two words x and y is defined as the number of symbols in x and y that do not belong to their longest common prefix. The relative prefix distance from a language L1 to a language L2, if finite, is the smallest integer k such that for every word in L1, there is a word in L2 with prefix distance at most k. We study the prefix distance between regular, visibly pushdown, ...
متن کاملLongest Path in Networks of Queues in the Steady-State
Due to the importance of longest path analysis in networks of queues, we develop an analytical method for computing the steady-state distribution function of longest path in acyclic networks of queues. We assume the network consists of a number of queuing systems and each one has either one or infinite servers. The distribution function of service time is assumed to be exponential or Erlang. Fu...
متن کاملState Complexity of Prefix Distance
The prefix distance between strings x and y is the number of symbol occurrences in the strings that do not belong to the longest common prefix of x and y. The suffix and the substring distances are defined analogously in terms of the longest common suffix and longest common substring, respectively, of two strings. We show that the set of strings within prefix distance k from an n state DFA (det...
متن کاملParallelizing Assignment Problem with DNA Strands
Background:Many problems of combinatorial optimization, which are solvable only in exponential time, are known to be Non-Deterministic Polynomial hard (NP-hard). With the advent of parallel machines, new opportunities have been emerged to develop the effective solutions for NP-hard problems. However, solving these problems in polynomial time needs massive parallel machines and ...
متن کاملComputing Vertex PI, Omega and Sadhana Polynomials of F12(2n+1) Fullerenes
The topological index of a graph G is a numeric quantity related to G which is invariant under automorphisms of G. The vertex PI polynomial is defined as PIv (G) euv nu (e) nv (e). Then Omega polynomial (G,x) for counting qoc strips in G is defined as (G,x) = cm(G,c)xc with m(G,c) being the number of strips of length c. In this paper, a new infinite class of fullerenes is constructed. ...
متن کامل